﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TRTCMain
{
    public partial class MsgSend : Form
    {
        TRTC.VideoMainForm videoMain1 = null;
        public MsgSend(TRTC.VideoMainForm videoMain)
        {
            InitializeComponent();
            videoMain1 = videoMain;
            //client1 = new WSocketClient(url);
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            this.Hide();
        }
      
        private void saveBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtmsg.Text))
            {
                System.Windows.MessageBox.Show("输入内容不能为空！","提示");
                return;
            }

            videoMain1?.SendDanMu(txtmsg.Text);

            this.Hide();
        }

        private void MsgSend_Load(object sender, EventArgs e)
        {
        }

        private void txtmsg_KeyDown(object sender, KeyEventArgs e)
        {
            //if (e.KeyCode == Keys.Enter) {
            //    e.Handled = true;
            //}
        }

        private void txtmsg_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13) {
                e.Handled = true;
            }
        }
    }
}
